package com.ftg.learn.chapter08.mton;

/**
 * @author kangjx
 * @createTime 2023/1/5
 */
public class RelationOfProFac {

    private int rno;

    private Factory factory;

    private Product product;

    public int getRno() {
        return rno;
    }

    public void setRno(int rno) {
        this.rno = rno;
    }

    public Factory getFactory() {
        return factory;
    }

    public void setFactory(Factory factory) {
        this.factory = factory;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public RelationOfProFac(int rno, Factory factory, Product product) {
        this.rno = rno;
        this.factory = factory;
        this.product = product;
    }

    public static void main(String[] args) {
        Factory f1 = new Factory();
        Factory f2 = new Factory();

        Product p1 = new Product();
        Product p2 = new Product();
        Product p3 = new Product();

        RelationOfProFac[] ps = new RelationOfProFac[5];

        ps[0] = new RelationOfProFac(1,f1,p1);
        ps[1] = new RelationOfProFac(2,f1,p2);
        ps[2] = new RelationOfProFac(3,f1,p3);

        ps[3] = new RelationOfProFac(4,f2,p2);
        ps[4] = new RelationOfProFac(5,f2,p3);


        for (int i = 0; i < ps.length; i++) {
            RelationOfProFac temp = ps[i];
            Factory ftemp = temp.getFactory();

            Product ptemp = temp.getProduct();
        }

    }

}
